srcs := $(wildcard *.c)
objects := $(patsubst %.c,%.o,$(srcs))
outputs := $(patsubst %.c,%,$(srcs))

all: $(outputs) $(objects)

# $(outputs): %: %.c
# 	$(CC) $(CFLAGS) $< -o $@

$(outputs): %: %.o
	echo 111 $(CC) $@ $<
	$(CC) $(CFLAGS) $< -o $@
	
$(objects): %.o: %.c
	echo 222 $(CC) $@ $<
	$(CC) -c $(CFLAGS) $< -o $@
	
.PHONY: clean
.PHONY: debug
debug: 
	echo $(srcs)
	echo $(objects)
	echo $(outputs)
	echo $(CC)
	echo $(CFLAGS)
.PHONY: 1 2
clean: 1 2
	echo $(CC) $@ $<
	rm -rf $(objects)
	rm -rf $(outputs)
